<template>
	<div>
  输入数据：<input type="text" v-model="userId"/><br />
  <button @click="change">发送</button>
<br />
<input type="text" v-model="userName"/>
	</div>
</template>

<script>
	import axios from 'axios'
	
	export default{
		data(){
			return{userName:"天才",userId:''}
		},
		methods:{
			change(){
				if(this.userId!=''){
									axios.post("/users/getName",{userId:this.userId}).then((response)=>{
					var res = response.data;
					if(res.status=='0'){
						console.log(res.result);
						this.userName = res.result.userName;
					}
				});
				}

				
			}
		}
		
	}
</script>

<style>
</style>